const A = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    isFilterType: false,
    isFilterArea: false,
    filterType: [
      {label: "全部", checked: true}
    ]
  },
  // 弹出选择状态和地区
  onFilterbar(e) {
    console.log(e);
    let type = A.C(e).type;
    if(type == 1) {
      this.setData({
        isFilterType: true,
        isFilterArea: false
      })
    }else {
      this.setData({
        isFilterType: false,
        isFilterArea: true
      })
    }
  },

  // 选择状态
  onFilterType(e) {
    let index = A.C(e).index;
    let filterType = this.data.filterType;
    filterType.map(item => item.checked = false)
    filterType[index].checked = true;
    this.setData({
      isFilterType: false,
      isFilterArea: false
    })
  },
  // 选择地区
  onFilterArea(e) {
    let index = A.C(e).index;
    let filterArea = this.data.filterArea;
    filterArea.map(item => item.checked = false)
    filterArea[index].checked = true;
    this.setData({
      isFilterType: false,
      isFilterArea: false
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})